<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<body >

<div style="position:relative;width:300px;margin:10px auto; padding:60px">
	<form id="fm-changepassword" action="<c:url value='/operset/modifypwd/savePwd'/>" method="post" style="padding:0;margin:0">
		<table cellpadding="5" cellspacing="0">
			<tr>
				<td style="width:60px">旧 密 码：</td>
				<td><input type="password" name="oldpwd" class="easyui-validatebox" tabindex="1"></td>
			</tr>
			<tr>
				<td>新 密 码：</td>
				<td><input type="password" name="newpwd" class="easyui-validatebox" tabindex="2"></td>
			</tr>
			<tr>
				<td>确认密码：</td>
				<td><input type="password" name="confirmpwd" class="easyui-validatebox" tabindex="3"></td>
			</tr>
			<tr>
                	<td align="right"></td>
                    <td align="left">
                    <div style="float:left;">
                    <img title="单击刷新" alt="验证码" src="<c:url value="/home/identifycode"/>" id="img_code" style="cursor: pointer" onclick="refresh()"/>
                    </div>
                    <div style="float:left;padding:3px;">
                    <a href="javascript:refresh();" >看不清点我</a>
                    </div>
                    </td>
                </tr>
 <tr>
                	<td align="right">验证码：</td>
                    <td align="left"><input class="inputCss1" type="text" id="identifycode" name="identifycode" maxlength="4" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" tabindex="4"></td>
                </tr>               
                <tr>	
			<tr><td>&nbsp;</td><td></td></tr>
			<tr>
				<td></td>
				<td><a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="changePassword()">保存</a></td>
			</tr>
		</table>
	</form>
</div>

<script>
function refresh() {   
	var img = document.getElementById("img_code");   
	img.src = '<c:url value="/home/identifycode"/>?r=' + Math.random();   
};

	function changePassword(){
		
			$('#fm-changepassword').form('submit', {
				onSubmit:function(){
					var cfmpwd = $(this).find('input[name=confirmpwd]').val();
					var newpwd = $(this).find('input[name=newpwd]').val();
					if (cfmpwd != newpwd){
						$.messager.alert('警告','新密码与确认密码不一致，请重新输入');
						return false;
					}
				},
				validate:function(){
					
				},
				success:function(data){
					var data = eval('('+data+')');
					if (data.success){
						$.messager.alert('信息','修改密码成功');
						$('#fm-changepassword').form('clear');
					} else {
						$.messager.alert('警告',data.msg);
					}
				}
			});
		
	}
</script>
</body>